package com.sky.controller.user;

import com.sky.mapper.SetmealDishMapper;
import com.sky.result.Result;
import com.sky.vo.DishItemVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController(value = "userSetmealDishController")
@RequestMapping("/user/setmeal/dish")
public class SetmealDIshController {
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private SetmealDishMapper setmealDishMapper;
    /**
     * 根据套餐id查询菜品
     */
    @GetMapping("/{id}")
    public Result<List<DishItemVO>> setmealDishList(@PathVariable Long id){
        log.info("根据套餐id查询菜品参数{}",id);
        List<DishItemVO> dishItemVOS = setmealDishMapper.selectDishItemsBysetmealId(id);
        log.info("根据套餐id查询菜品参数{}",dishItemVOS);
        return Result.success(dishItemVOS);
    }
}
